const axios = require('axios');
const MockAdapter = require('axios-mock-adapter');
const normalAxios = axios.create();
const mockAxios = axios.create();
import url_config from "./config";
import reqTools from "../utils/reqTools";

// mock 数据   平台 声波锁离线版
var mock = new MockAdapter(mockAxios);

       //查询用户曲线图
       mock.onGet('/usercurve').reply((config) => {
        return new Promise(function(resolve, reject) {
          reqTools.get('/api/platformbalancelog/usercurve',
          config).then((res) => {
            resolve([200, res]);
          }).catch((err) => {
            resolve([500, err ]);
          });
        });
      });

      //查询代理商曲线图
      mock.onGet('/officecurve').reply((config) => {
        return new Promise(function(resolve, reject) {
          reqTools.get('/api/platformbalancelog/officecurve',
          config).then((res) => {
            resolve([200, res]);
          }).catch((err) => {
            resolve([500, err ]);
          });
        });
      });

      //查询平台收益曲线图
      mock.onGet('/balancecurve').reply((config) => {
        return new Promise(function(resolve, reject) {
          reqTools.get('/api/platformbalancelog/balancecurve',
          config).then((res) => {
            resolve([200, res]);
          }).catch((err) => {
            resolve([500, err ]);
          });
        });
      });

            //查询广告投放数量曲线图
            mock.onGet('/advcurve').reply((config) => {
              return new Promise(function(resolve, reject) {
                reqTools.get('/api/platformbalancelog/advcurve',
                config).then((res) => {
                  resolve([200, res]);
                }).catch((err) => {
                  resolve([500, err ]);
                });
              });
            });

export default mockAxios;
